@import '~@hi-ui/core-css/lib/index.scss';

// 默认态

$link-color-map: (
  'primary': use-color-mode('primary'),
  'secondary': use-color-mode('primary', 400),
  'default': use-color('gray', 700),
  'success': use-color-mode('success'),
  'danger': use-color-mode('danger'),
) !default;

// hover 态

$link-hover-color-map:(
  'primary': use-color-mode('primary', 400),
  'secondary': use-color-mode('primary', 300),
  'default': use-color('gray', 600),
  'success': use-color-mode('success', 400),
  'danger': use-color-mode('danger', 400),
) !default;

// active 态

$link-active-color-map: (
  'primary': use-color-mode('primary', 600),
  'secondary': use-color-mode('primary'),
  'default': use-color-static('black'),
  'success': use-color-mode('success', 600),
  'danger': use-color-mode('danger', 600),
) !default;

// 禁用态

$link-disabled-color-map: (
  'primary': use-color-mode('primary', 300),
  'secondary': use-color-mode('primary', 200),
  'default': use-color('gray', 500),
  'success': use-color-mode('success', 300),
  'danger': use-color-mode('danger', 300),
) !default;

// focus 态
$link-focus-shadow-map: (
  'primary': use-color-static('transparent'),
  'secondary': use-color-static('transparent'),
  'default': use-color-static('transparent'),
  'success': use-color-static('transparent'),
  'danger': use-color-static('transparent'),
) !default;

@mixin render-link-button() {
  & {
    &--appearance-link {
      padding: 0;
      border: 0;
    }

    $color-list: ('primary', 'secondary', 'default', 'success', 'danger');

    @each $key in $color-list {
      $prefix: & !default;
      &--appearance-link#{&}--type-#{$key} {
        color: map-get($link-color-map, $key);

        &:not(.#{$prefix}--disabled):not(.#{$prefix}--loading):hover {
          color: map-get($link-hover-color-map, $key);
        }

        &:not(.#{$prefix}--disabled):not(.#{$prefix}--loading):active {
          color: map-get($link-active-color-map, $key);
        }

        &:not(.#{$prefix}--disabled):not(.#{$prefix}--loading):focus {
          box-shadow: 0 0 0 2px map-get($link-focus-shadow-map, $key);
        }

        &.#{$prefix}--disabled {
          color: map-get($link-disabled-color-map, $key);
        }
      }
    }
  }
}
